# coding:utf-8


from datetime import datetime
from .. import db


class Material(db.Model):
    __tablename__ = 'materials'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(32), nullable=False)
    keywords = db.Column(db.String(128), nullable=False)
    storage_time = db.Column(db.DateTime, default=datetime.now)
    location = db.Column(db.String(32), nullable=False)
    description = db.Column(db.Text)
    expiration = db.Column(db.Date, nullable=True)
    picture = db.Column(db.String(128))

    def __unicode__(self):
        return '<Material %r-%r>' % self.name, self.description
